#!/bin/bash

set -e
set -x

echo "Setting SOURCE_BRANCH to ${SOURCE_BRANCH}"
sed -i "s@^ENV SOURCE_BRANCH \"release\"@ENV SOURCE_BRANCH \"${SOURCE_BRANCH}\"@g" Dockerfile

SOURCE_COMMIT=$(curl -s 'https://api.github.com/repos/WaykiChain/WaykiChain/commits' | grep sha | head -1 | cut -c 13-20)
echo "Setting SOURCE_COMMIT: $SOURCE_COMMIT"
sed -i "s@SOURCE_COMMIT@${SOURCE_COMMIT}@g" Dockerfile